// Copyrights by Kenneth Lee, 2022. All Rights Reserved

#ifndef __ANA_VAL_HPP__
#define __ANA_VAL_HPP__

#include <iostream>
#include <assert.h>

#include "valif.hpp"

class AnaVal: public ValIf {
private:
	int numer, demom;	// numerator and demominator
	void simplify(void);
public:
	AnaVal(int i);
	AnaVal(const char *s);
	AnaVal(int n, int d);
	AnaVal();
	AnaVal &operator=(const char *s);
	friend ostream & operator<<(ostream & os, const AnaVal & fv);
	friend bool operator==(const AnaVal &l, const AnaVal &r);
	friend bool operator==(const AnaVal &l, const int &r);
	friend AnaVal operator+(const AnaVal &l, const AnaVal &r);
	friend AnaVal operator-(const AnaVal &l, const AnaVal &r);
	friend AnaVal operator*(const AnaVal &l, const AnaVal &r);
	friend AnaVal operator/(const AnaVal &l, const AnaVal &r);
};

extern ostream & operator<<(ostream & os, const AnaVal & fv);
extern bool operator==(const AnaVal &l, const AnaVal &r);
extern bool operator==(const AnaVal &l, const int &r);
extern AnaVal operator+(const AnaVal &l, const AnaVal &r);
extern AnaVal operator-(const AnaVal &l, const AnaVal &r);
extern AnaVal operator*(const AnaVal &l, const AnaVal &r);
extern AnaVal operator/(const AnaVal &l, const AnaVal &r);

#endif
